<?php

/**
 * Jugador filter form base class.
 *
 * @package    ehockey
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseJugadorFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'sector'            => new sfWidgetFormChoice(array('choices' => array('' => '', 'Damas' => 'Damas', 'Caballeros' => 'Caballeros'))),
      'habilitado'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'apellido'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nombre'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'tipo_documento'    => new sfWidgetFormChoice(array('choices' => array('' => '', 'DNI' => 'DNI', 'C.I' => 'C.I', 'L.C.' => 'L.C.', 'L.E.' => 'L.E.', 'Pasaporte' => 'Pasaporte'))),
      'numero_documento'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fecha_nacimiento'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'telefono'          => new sfWidgetFormFilterInput(),
      'fecha_alta'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'club_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Club'), 'add_empty' => true)),
      'tarjetasVerdes'    => new sfWidgetFormFilterInput(),
      'tarjetasAmarillas' => new sfWidgetFormFilterInput(),
      'created_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'sector'            => new sfValidatorChoice(array('required' => false, 'choices' => array('Damas' => 'Damas', 'Caballeros' => 'Caballeros'))),
      'habilitado'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'apellido'          => new sfValidatorPass(array('required' => false)),
      'nombre'            => new sfValidatorPass(array('required' => false)),
      'tipo_documento'    => new sfValidatorChoice(array('required' => false, 'choices' => array('DNI' => 'DNI', 'C.I' => 'C.I', 'L.C.' => 'L.C.', 'L.E.' => 'L.E.', 'Pasaporte' => 'Pasaporte'))),
      'numero_documento'  => new sfValidatorPass(array('required' => false)),
      'fecha_nacimiento'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'telefono'          => new sfValidatorPass(array('required' => false)),
      'fecha_alta'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'club_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Club'), 'column' => 'id')),
      'tarjetasVerdes'    => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'tarjetasAmarillas' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('jugador_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Jugador';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'sector'            => 'Enum',
      'habilitado'        => 'Boolean',
      'apellido'          => 'Text',
      'nombre'            => 'Text',
      'tipo_documento'    => 'Enum',
      'numero_documento'  => 'Text',
      'fecha_nacimiento'  => 'Date',
      'telefono'          => 'Text',
      'fecha_alta'        => 'Date',
      'club_id'           => 'ForeignKey',
      'tarjetasVerdes'    => 'Number',
      'tarjetasAmarillas' => 'Number',
      'created_at'        => 'Date',
      'updated_at'        => 'Date',
    );
  }
}
